import fetch from '@/utils/fetch'

export function getUserList() {
  return fetch({
    url: '/user',
    method: 'GET'
  })
}

export function deleteById(id) {
  return fetch({
    url: `/user/?id=${id}`,
    method: 'DELETE'
  })
}

export function update(form) {
  return fetch({
    url: `/user/?id=${form.id}`,
    method: 'PUT',
    data: form
  })
}

export function adduser(form) {
  return fetch({
    url: '/user/',
    method: 'POST',
    data: form
  })
}

export function login(data) {
  return fetch({
    url: '/user/login',
    method: 'POST',
    data
  })
}

export function signup(data) {
  return fetch({
    url: '/user/signup',
    method: 'POST',
    data
  })
}

export function getUserInfo() {
  return fetch({
    url: '/user/info',
    method: 'GET'
  })
}


export function logUserOut() {
  return fetch({
    url: 'user/logout',
    method: 'GET'
  })
}
